package com.xiongjie.impl;

import com.xiongjie.util.PgWrapper;
import io.reactiverse.pgclient.Tuple;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
import io.vertx.core.json.JsonObject;
import static com.xiongjie.util.PgWrapper.collectJsonObject;

public final class IPersonImpl implements IPerson {

    private final PgWrapper pg;

    public IPersonImpl(PgWrapper pg) {
        this.pg = pg;
    }

    @Override
    public void getPersonByName(String name, Handler<AsyncResult<JsonObject>> resultHandler) {
        pg.queryOne("getPersonByName", Tuple.of(name), collectJsonObject(), resultHandler);
    }
}
